<template>
  <el-menu :default-openeds="opens" style="min-height: 100%; overflow-x: hidden"
           background-color="rgb(48, 65, 86)"
           text-color="#fff"
           active-text-color="#ffd04b"
           :collapse-transition="false"
           :collapse="isCollapse"
           router
  >
    <div style="height: 60px; line-height: 60px; text-align: center; padding: 0 0px">
      <b style="color: #fff" v-show="logoTextShow">薪资管理系统</b>
    </div>
<!--    <div v-for="item in menus" :key="item.menuId">
      &lt;!&ndash;  判断pid有没有 没有就是一级    &ndash;&gt;
      <div v-if="item.menuPath">
        <el-menu-item :index="item.menuPath">
          <i :class="item.menuIcon"></i>
          <span slot="title">{{item.menuName}}</span>
        </el-menu-item>
      </div>
      <div v-else>
        <el-submenu :index="item.menuId +'0'">
          <template slot="title">
            <i :class="item.menuIcon"></i>
            <span slot="title">{{item.menuName}}</span>
          </template>
          &lt;!&ndash;  遍历子级    &ndash;&gt;
          <div v-for="subItem in item.children" :key="subItem.menuId">
            <el-menu-item :index="subItem.menuPath">
              <i :class="subItem.menuIcon"></i>
              <span slot="title">{{subItem.menuName}}</span>
            </el-menu-item>
          </div>
        </el-submenu>
      </div>
    </div>-->
    <el-menu-item index="/pandect">
        <i class="el-icon-house"></i>
        <span slot="title">首页</span>
    </el-menu-item>
    <el-submenu index="1-1">
      <template slot="title">
        <i class="el-icon-s-home"></i>
        <span slot="title">组织机构</span>
      </template>
        <el-menu-item index="/organization">
          <span slot="title">组织管理</span>
        </el-menu-item>
      <el-menu-item index="/post">
        <span slot="title">岗位管理</span>
      </el-menu-item>
        <el-menu-item index="/duties">
            <span slot="title">职务管理</span>
        </el-menu-item>
    </el-submenu>

    <el-submenu index="1-2">
          <template slot="title">
              <i class="el-icon-s-home"></i>
              <span slot="title">人事管理</span>
          </template>
          <el-menu-item index="/duties">
              <span slot="title">人员管理</span>
          </el-menu-item>
          <el-menu-item index="/post">
              <span slot="title">转正管理</span>
          </el-menu-item>
          <el-menu-item index="/duties">
              <span slot="title">离职管理</span>
          </el-menu-item>
    </el-submenu>

    <el-submenu index="1-3">
          <template slot="title">
              <i class="el-icon-s-home"></i>
              <span slot="title">社保公积金</span>
          </template>
          <el-menu-item index="/socialScheme">
              <span slot="title">社保方案</span>
          </el-menu-item>
          <el-menu-item index="/accumScheme">
              <span slot="title">公积金方案</span>
          </el-menu-item>
          <el-menu-item index="/decreasePersonnel">
              <span slot="title">增减人员</span>
          </el-menu-item>
          <el-menu-item index="/duties">
              <span slot="title">参保档案</span>
          </el-menu-item>
        <el-menu-item index="/duties">
            <span slot="title">险种设置</span>
        </el-menu-item>
    </el-submenu>


    <el-submenu index="1-4">
          <template slot="title">
              <i class="el-icon-s-home"></i>
              <span slot="title">员工薪资</span>
          </template>
          <el-menu-item index="/duties">
              <span slot="title">薪资档案</span>
          </el-menu-item>
          <el-menu-item index="/post">
              <span slot="title">薪资调整</span>
          </el-menu-item>
          <el-menu-item index="/duties">
              <span slot="title">定薪模板</span>
          </el-menu-item>
    </el-submenu>

    <el-submenu index="1-5">
          <template slot="title">
              <i class="el-icon-s-home"></i>
              <span slot="title">薪资核算</span>
          </template>
          <el-menu-item index="/duties">
              <span slot="title">薪资项目</span>
          </el-menu-item>
          <el-menu-item index="/post">
              <span slot="title">薪资方案</span>
          </el-menu-item>
          <el-menu-item index="/duties">
              <span slot="title">薪资台账</span>
          </el-menu-item>
    </el-submenu>

    <el-submenu index="1-6">
          <template slot="title">
              <i class="el-icon-s-home"></i>
              <span slot="title">个税数据</span>
          </template>
          <el-menu-item index="/duties">
              <span slot="title">专项附加扣除</span>
          </el-menu-item>
          <el-menu-item index="/post">
              <span slot="title">累计应纳税所得额</span>
          </el-menu-item>
          <el-menu-item index="/duties">
              <span slot="title">计税规则</span>
          </el-menu-item>
    </el-submenu>

    <el-submenu index="1-7">
          <template slot="title">
              <i class="el-icon-s-home"></i>
              <span slot="title">考勤数据</span>
          </template>
          <el-menu-item index="/duties">
              <span slot="title">考勤计薪资规则</span>
          </el-menu-item>
          <el-menu-item index="/post">
              <span slot="title">考勤报表</span>
          </el-menu-item>
    </el-submenu>

    <el-submenu index="1-8">
          <template slot="title">
              <i class="el-icon-s-home"></i>
              <span slot="title">工资单管理</span>
          </template>
          <el-menu-item index="/duties">
              <span slot="title">工资单设置</span>
          </el-menu-item>
          <el-menu-item index="/post">
              <span slot="title">工资发放</span>
          </el-menu-item>
    </el-submenu>
    <el-submenu index="1-9">
      <template slot="title">
        <i class="el-icon-key"></i>
        <span slot="title">系统设置</span>
      </template>
      <el-menu-item index="/duties">
        <span slot="title">用户管理</span>
      </el-menu-item>
      <el-menu-item index="/duties">
        <span slot="title">角色管理</span>
      </el-menu-item>
      <el-menu-item index="/duties">
        <span slot="title">个人中心</span>
      </el-menu-item>
    </el-submenu>
  </el-menu>
</template>

<script>
export default {
  name: "Aside",
  props: {
    isCollapse: Boolean,    //控制侧边收缩
    logoTextShow: Boolean,  //后台管理文字隐藏
    // menus: Array //角色菜单数据
  },
  data(){
    return {
      //角色菜单数据
      menus: localStorage.getItem("menuList") ? JSON.parse(localStorage.getItem("menuList")) : [],
      //菜单默认展开
      opens: localStorage.getItem("menuList") ? JSON.parse(localStorage.getItem("menuList")).map(v => v.id + '') : [],
    }
  }
}
</script>

<style scoped>
/*解决收缩菜单文字不消失问题*/
.el-menu--collapse span {
  visibility: hidden;
}
</style>
